package cn.etynit.mms.fallback;

import cn.etynit.domain.ExpenseCar;
import cn.etynit.exception.GlobalExceptionCodeEnum;
import cn.etynit.mms.feign.ExpenseCarService;
import cn.etynit.result.JsonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class ExpenseCarServiceFallbackFactory implements FallbackFactory<ExpenseCarService> {

    @Override
    public ExpenseCarService create(Throwable throwable) {
        return new ExpenseCarService() {
            @Override
            public JsonResult saveOrUpdate(ExpenseCar expenseCar) {
                return JsonResult.error(GlobalExceptionCodeEnum.ERROR);
            }

            @Override
            public JsonResult list() {
                return JsonResult.error(GlobalExceptionCodeEnum.ERROR);
            }

            @Override
            public JsonResult surplusParkingSpace(Integer type) {
                return JsonResult.error(GlobalExceptionCodeEnum.ERROR);
            }

            @Override
            public JsonResult selectByUserId(Long id) {
                return JsonResult.error(GlobalExceptionCodeEnum.ERROR);
            }
        };
    }
}
